package p17.p1724;

import java.util.HashSet;
import java.util.Random;

//获取随机数,不重复
public class HashSetDemo {
    public static void main(String[] args) {
        String sss;
        Random r = new Random();
        // System.out.println("r = " + r.nextInt(20));
        HashSet<Integer> ts = new HashSet<>();
        while (ts.size() < 10) {
            int num = r.nextInt(20) + 1;
            ts.add(num);
            //System.out.println("num = " + num);
        }

        for (Integer a : ts
                ) {
            System.out.println("a = " + a);
        }
    }
}
